package com.java.zhuiyun.usertask.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.java.zhuiyun.api.sysrolemenu.entity.RoleMenu;
import com.java.zhuiyun.api.task.entity.Task;
import com.java.zhuiyun.usertask.entity.UserTask;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @InterfaceName UserTaskMapper
 * @Description TODO 用户任务关联表mapper
 * @Author xy
 * @Date 2023/10/16 13:54
 **/
@Mapper
public interface UserTaskMapper extends BaseMapper<UserTask> {

    /**
    * @Author xy
    * @Description todo 根据用户id删除用户任务关联表
    * @Date 2023/10/16 14:08
    * @Return
    * @param
    */
    @Delete("delete from user_task where userid = #{userid}")
    int deleteByUserId(@Param("userid") Integer userid);

    /**
    * @Author xy
    * @Description todo 根据用户id查询用户任务关联表
    * @Date 2023/10/16 14:09
    * @Return
    * @param
    */
    @Select("select taskid from user_task where userid = #{userid}")
    List<Integer> selectByUserId(@Param("userid")Integer userid);

    /**
    * @Author xy
    * @Description todo 根据用户id查询用户任务关联表
    * @Date 2023/10/16 14:09
    * @Return
    * @param
    */
    @Insert("insert into user_task (userid, taskid) values (#{userid}, #{taskid})")
    Integer inserts(Task task);
}
